<div class="x_page-header">
	<h1>RSS <a class="x_icon-question-sign" href="./admin/help/index.html#UMAN_content_rss" target="_blank">{$lang->help}</a></h1>
</div>
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/rss/tpl/rss_admin_index/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
	<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<section class="section">
	<h1>{$lang->total_feed} {$lang->cmd_management}</h1>
	<form ruleset="insertRssConfig" action="./" method="post" enctype="multipart/form-data" class="x_form-horizontal">
		<input type="hidden" name="module" value="rss" />
		<input type="hidden" name="act" value="procRssAdminInsertConfig" />
		<input type="hidden" name="xe_validator_id" value="modules/rss/tpl/rss_admin_index/1" />
		<div class="x_control-group">
			<div class="x_control-label">{$lang->url}</div>
			<div class="x_controls" style="padding-top:5px"><a href="{getFullSiteUrl()}rss" target="_blank">{getFullSiteUrl()}rss</a></div>
		</div>
		<div class="x_control-group">
			<label class="x_control-label">{$lang->total_feed}</label>
			<div class="x_controls">
				<label class="x_inline">
					<input type="radio" name="use_total_feed" value="Y" id="use_total_feed_yes" checked="checked"|cond="!$total_config->use_total_feed || $total_config->use_total_feed == 'Y'" /> {$lang->use}
				</label>
				<label class="x_inline">
					<input type="radio" name="use_total_feed" value="N" id="use_total_feed_no" checked="checked"|cond="$total_config->use_total_feed == 'N'" /> {$lang->notuse}
				</label>
			</div>
		</div>
		<div class="x_control-group">
			<label class="x_control-label" for="feed_title">{$lang->title}</label>
			<div class="x_controls">
				<input type="text" name="feed_title" value="{htmlspecialchars($total_config->feed_title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)}" id="feed_title" />
			</div>
		</div>
		<div class="x_control-group">
			<label class="x_control-label" for="feed_description">{$lang->description}</label>
			<div class="x_controls">
				<textarea name="feed_description" id="feed_description" rows="4" cols="42" style="float:left;margin-right:8px">{$total_config->feed_description}</textarea>
				<p class="x_help-block">{$lang->about_feed_description}</p>
			</div>
		</div>
		<div class="x_control-group">
			<label class="x_control-label" for="image">{$lang->feed_image}</label>
			<div class="x_controls">
			
			<!--@if($total_config->image)-->
			<div class="_rss_image_container">
				<div class="x_thumbnail" cond="$total_config->image" style="display:inline-block;margin:0 0 5px 0"> 
					<img src="../../../{$total_config->image}" alt="image" style="max-width:210px;max-height:150px" />
					<input type="button" class="_delete_rss_image x_icon-remove" value="{$lang->cmd_delete}" style="width:14px" />
				</div>
				
			</div>
			<!--@end-->
				<p><input type="file" name="image" value="" id="image" /></p>
			</div>
		</div>
		<div class="x_control-group">
			<label class="x_control-label" for="feed_copyright">{$lang->feed_copyright}</label>
			<div class="x_controls">
				<input type="text" name="feed_copyright" value="{htmlspecialchars($total_config->feed_copyright, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)}" id="feed_copyright" />
			</div>
		</div>
		<div class="x_control-group">
			<label class="x_control-label" for="feed_document_count">{$lang->feed_document_count}</label>
			<div class="x_controls">
				<input type="number" min="1" max="100" name="feed_document_count" value="{$total_config->feed_document_count}" id="feed_document_count" />
			</div>
		</div>
		<div class="btnArea x_clearfix">
			<button type="submit" class="x_btn x_btn-primary x_pull-right">{$lang->cmd_save}</button>
		</div>
	</form>
</section>
<section class="section">
	<h1 style="margin-bottom:0">{$lang->feed} {$lang->cmd_management}</h1>
	<form action="./" method="post">
		<input type="hidden" name="act" value="procRssAdminInsertModuleConfig" />
		<input type="hidden" name="success_return_url" value="{getUrl('', 'module', $module, 'act', 'dispRssAdminIndex')}" />
		<input type="hidden" name="xe_validator_id" value="modules/rss/tpl/rss_admin_index/1" />
		<table class="x_table x_table-striped x_table-hover" style="border-top:0;margin-top:0">
			<thead>
				<tr>
					<th>{$lang->mid}</th>
					<th>{$lang->description}</th>
					<th>{$lang->open_rss}</th>
					<th>{$lang->open_feed_to_total}</th>
				</tr>
			</thead>
			<tbody>
				<tr loop="$feed_config => $key,$value">
					<th cond="!$value['url']">
						{$value['mid']}
					</th>
					<th cond="$value['url']">
						<a href="{$value['url']}" target="_blank">{$value['mid']}</a>
					</th>
					<td class="title">{$value['feed_description']}<textarea name="feed_description[{$key}]" hidden>{$value['feed_description']}</textarea></td>
					<td>
						<label class="x_inline" loop="$lang->open_rss_types => $key2,$value2"><input type="radio" name="open_rss[{$key}]" value="{$key2}" checked="checked"|cond="$key2 == $value['open_feed']" /> {$value2}</label>
					</td>
					<td>
						<label class="x_inline"><input type="radio" name="open_total_feed[{$key}]" value="N" checked="checked"|cond="$value['open_total_feed'] != 'T_N'" /> {$lang->use}</label>
						<label class="x_inline"><input type="radio" name="open_total_feed[{$key}]" value="T_N" checked="checked"|cond="$value['open_total_feed'] == 'T_N'" /> {$lang->notuse}</label>
					</td>
				</tr>
				<tr cond="!$feed_config">
					<td style="text-align:center">{$lang->no_data}</td>
				</tr>
			</tbody>
		</table>
		<div class="x_clearfix">
			<button type="submit" class="x_btn x_btn-primary x_pull-right">{$lang->cmd_save}</button>
		</div>
	</form>
</section>
<script>
jQuery(function($){
	$("._delete_rss_image").click(function(){
		$.exec_json('rss.procRssAdminDeleteFeedImage', {del_image:'Y'}, function(){
			$("._rss_image_container").hide();
		});
	});
});
</script>
